home *** CD-ROM | disk | FTP | other *** search
- //***********************************************************************
- //
- // MainFrame.cpp
- //
- //***********************************************************************
-
- #include <afxwin.h>
- #include <afxext.h>
- #include "MainFrame.h"
-
- IMPLEMENT_DYNCREATE (CMainFrame, CFrameWnd)
-
- BEGIN_MESSAGE_MAP (CMainFrame, CFrameWnd)
- ON_WM_CREATE ()
- ON_MESSAGE (WM_USER, OnUpdateImageStats)
- ON_WM_QUERYNEWPALETTE ()
- ON_WM_PALETTECHANGED ()
- END_MESSAGE_MAP ()
-
- int CMainFrame::OnCreate (LPCREATESTRUCT lpcs)
- {
- static UINT nIndicators[] = {
- ID_SEPARATOR,
- ID_SEPARATOR,
- };
-
- if (CFrameWnd::OnCreate (lpcs) == -1)
- return -1;
-
- if (!m_wndStatusBar.Create (this))
- return -1;
-
- m_wndStatusBar.SetIndicators (nIndicators, 2);
-
- TEXTMETRIC tm;
- CClientDC dc (this);
- CFont* pFont = m_wndStatusBar.GetFont ();
- CFont* pOldFont = dc.SelectObject (pFont);
- dc.GetTextMetrics (&tm);
- dc.SelectObject (pOldFont);
-
- int cxWidth;
- UINT nID, nStyle;
- m_wndStatusBar.GetPaneInfo (1, nID, nStyle, cxWidth);
- cxWidth = tm.tmAveCharWidth * 24;
- m_wndStatusBar.SetPaneInfo (1, nID, nStyle, cxWidth);
- return 0;
- }
-
- LONG CMainFrame::OnUpdateImageStats (UINT wParam, LONG lParam)
- {
- m_wndStatusBar.SetPaneText (1, (LPCTSTR) lParam, TRUE);
- return 0;
- }
-
- BOOL CMainFrame::OnQueryNewPalette ()
- {
- GetActiveView ()->Invalidate (FALSE);
- return TRUE;
- }
-
- void CMainFrame::OnPaletteChanged (CWnd* pFocusWnd)
- {
- if (pFocusWnd != this)
- GetActiveView ()->Invalidate (FALSE);
- }
-